package projecta;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;


public class DbConnector {
	private final String JDBC_DRIVER ="com.mysql.jdbc.Driver"; 
	private final String JDBC_URL = "jdbc:mysql://localhost:3306/spid";
	private final String USER = "root";
	private final String PASS = "cocoa245";
	
	public Connection conn;
	
	public DbConnector() throws SQLException, Exception{
		try{
			Class.forName(JDBC_DRIVER).newInstance();
			conn = DriverManager.getConnection(JDBC_URL, USER, PASS);
		}
		catch(SQLException ex){
			throw ex;
		}
		catch(Exception ex){
			throw ex;
		}
	}

	public void close() {
		// TODO Auto-generated method stub
		try {
			conn.close();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
